﻿@model System.Web.Mvc.HandleErrorInfo

@{
    ViewBag.Title = "Error";
}

<h2>
    Sorry, an error occurred while processing your request.
</h2>

<div>
    You will be redirected to the Home Page in
    <span class = "countdown"></span>
</div>



@*<div>
    @Model.Exception.Message
</div>*@

<script  type="text/javascript" language="javascript">
    $.fn.countdown = function (callback, duration, message) {
        // If no message is provided, we use an empty string
        message = message || "";
        // Get reference to container, and set initial content
        var container = $(this[0]).html(duration + message);
        // Get reference to the interval doing the countdown
        var countdown = setInterval(function () {
            // If seconds remain
            if (--duration) {
                // Update our container's message
                container.html(duration + message);
                // Otherwise
            } else {
                // Clear the countdown interval
                clearInterval(countdown);
                // And fire the callback passing our container as `this`
                callback.call(container);
            }
            // Run interval every 1000ms (1 second)
        }, 1000);

    };
    $(".countdown").countdown(redirect, 5, "s...");

    // Function to be called after 5 seconds
    function redirect() {
        this.html("Redirecting...");
        window.location = "/Home/";
    }

</script>